package com.zxhhyj.music.ui

import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material.Button
import androidx.compose.material.Icon
import androidx.compose.material.Text
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.rounded.PlaylistPlay
import androidx.compose.material.icons.rounded.Album
import androidx.compose.material.icons.rounded.Mic
import androidx.compose.material.icons.rounded.Source
import androidx.compose.runtime.Composable
import androidx.compose.runtime.snapshots.SnapshotStateList
import androidx.compose.ui.Modifier
import com.zxhhyj.music.Screen
import com.zxhhyj.ui.view.AppScaffold
import com.zxhhyj.ui.view.AppTopBar
import com.zxhhyj.ui.view.RoundColumn
import com.zxhhyj.ui.view.item.ItemArrowRight
import com.zxhhyj.ui.view.item.ItemDivider
import com.zxhhyj.ui.view.item.ItemSpacer
import com.zxhhyj.ui.view.roundColumn

@Composable
fun Home(backStack: SnapshotStateList<Screen>) {
    AppScaffold(
        modifier = Modifier.fillMaxSize(),
        topBar = {
            AppTopBar(title = {
                Text("StarMusic")
            })
        }) {
        LazyColumn(
            modifier = Modifier.fillMaxSize(),
            contentPadding = it
        ) {
            item {
                RoundColumn {
                    ItemArrowRight(
                        icon = {
                            Icon(
                                imageVector = Icons.AutoMirrored.Rounded.PlaylistPlay,
                                contentDescription = null
                            )
                        },
                        text = { Text(text = "PlayList") },
                        subText = { }) {

                    }
                    ItemDivider()
                    ItemArrowRight(
                        icon = {
                            Icon(
                                imageVector = Icons.Rounded.Album, contentDescription = null
                            )
                        },
                        text = { Text(text = "Album") },
                        subText = { }) {

                    }
                    ItemDivider()
                    ItemArrowRight(
                        icon = {
                            Icon(
                                imageVector = Icons.Rounded.Mic, contentDescription = null
                            )
                        },
                        text = { Text(text = "Singer") },
                        subText = { }) {

                    }
                    ItemDivider()
                    ItemArrowRight(
                        icon = {
                            Icon(
                                imageVector = Icons.Rounded.Source, contentDescription = null
                            )
                        },
                        text = { Text(text = "Source") },
                        subText = { }) {
                        backStack.add(Screen.Source)
                    }
                }
            }

            item {
                ItemSpacer()
            }

            roundColumn {
                repeat(10) {
                    item {
                        Button(onClick = {}) {}
                    }
                }
            }
        }
    }
}